package mylab.starters.mq.impl.redis;

import mylab.starters.cache.support.redis.RedisNotice;
import mylab.starters.mq.api.Message;
import mylab.starters.mq.api.Properties;
import mylab.starters.mq.impl.AbstractProducer;
import mylab.utils.spring.SpringUtil;


public class RedisProducer extends AbstractProducer {

    RedisNotice redisNotice;

    public RedisProducer(Properties properties, String groupId, String clientId) {
        super(properties, groupId, clientId);

        redisNotice = SpringUtil.getBean(RedisNotice.class);
    }


    @Override
    protected void onStart() throws Exception {

    }

    @Override
    protected void onStop() throws Exception {

    }

    @Override
    protected Object onSend(Message message) throws Exception {
        redisNotice.publish(message.getTopic(), message.getContent());
        return null;
    }
}
